package br.com.playonline.bussines;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.playonline.domain.Endereco;
import br.com.playonline.persistencia.EnderecoHibernateDAO;

@Component
public class EnderecoBU {

	@Autowired
	EnderecoHibernateDAO enderecoHibernateDAO;
	
//	@Autowired
//	HibernateDAOGenerico<Endereco, Long> hibernateDAOGenerico;
	
	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
	public Endereco save(Endereco endereco){
		return this.enderecoHibernateDAO.save(endereco);
	}
	
	public List<Endereco> findAll(){
		return this.enderecoHibernateDAO.findAll();
	}
	
}
